package cn.lizhangqu.kb.handler;


import android.util.Log;

import org.json.JSONException;
import org.json.JSONObject;

import cn.lizhangqu.kb.model.Paging;

/**
 * Created by 戴文龙 on 2014/12/29.
 */
public class PageJsonResponseHandler extends JsonResponseHandler<Paging> {

    private static final String JSON_KEY_RECORDS = "records";
    private static final String JSON_KEY_PAGE_SIZE = "size";
    private static final String JSON_KEY_PAGE_COUNT = "count";
    private static final String JSON_KEY_CURRENT_PAGE = "current";

    @Override
    protected Paging parseItem(JSONObject json) throws JSONException {
        Paging paging = new Paging();

        if (hasKeyValue(json, "pageSize")) {
            int pageSize = json.getInt("pageSize");
            Log.d("p!!!p", pageSize + "");


        }
//
//        if(hasKeyValue(json,JSON_KEY_PAGE_COUNT)) {
//            paging.setPageCount(json.getInt(JSON_KEY_PAGE_COUNT));
//        }
//
//        if(hasKeyValue(json,JSON_KEY_CURRENT_PAGE)){
//            paging.setCurrentPage(json.getInt(JSON_KEY_CURRENT_PAGE));
//        }
//
//        if(hasKeyValue(json,JSON_KEY_PAGE_SIZE)) {
//            paging.setPageSize(json.getInt(JSON_KEY_PAGE_SIZE));
//        }

        return paging;
    }
}
